﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using BCDto.Common.Cooperation.WebsiteCooperation;
using BCService.Common.Cooperation.WebsiteCooperation;
using BCTMSRESTful.Configs;
using Microsoft.AspNetCore.Mvc;

// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace BCTMSRESTful.Controllers.Anonymous
{
    [Route("api/v1/[controller]")]
    [ApiController]
    public class CooperationController : BCTMSRESTfulAPIController
    {
        private readonly IWebsiteCooperationService websiteCooperationService;

        public CooperationController(IWebsiteCooperationService websiteCooperationService)
        {
            this.websiteCooperationService = websiteCooperationService;
        }

        #region 添加官网合作留言
        /// <summary>
        ///  添加官网合作留言
        /// </summary>
        /// <param name="requestDto">官网合作留言信息</param>
        /// <response code="201">添加官网合作留言成功</response>
        /// <response code="400">请求参数或输入的数据不正确。</response>
        /// <response code="500">服务器发生错误。</response>
        /// <response code="501">某些功能尚未实现。</response>
        /// <returns></returns>
        [HttpPost]
        [Log("添加官网合作留言")]
        [ProducesResponseType(typeof(WebsiteCooperationDto), 201)]
        public IActionResult Post(
            [FromBody]WebsiteCooperationRequestDto requestDto)
        {
            var result = this.websiteCooperationService.Add(requestDto);
            return StatusCode((int)HttpStatusCode.Created, result);
        }
        #endregion
    }
}
